﻿using Hydrogen.Cmd.Interfaces;
using Hydrogen.Console;
using System.Collections.Generic;
using SConsole = System.Console;

namespace Hydrogen.Cmd.buildinCmds
{
    [CommandFlag("h", "help")]
    class HelpCommand : CommandBase
    {
        public static new string Discription
        {
            get
            {
                string description = "Help Infomation.";
                return description;
            }
        }
        public override void Invoke(params string[] args)
        {
            //            string helpInfo = @"<Hydrogen.Cmd>
            //[Author] @author
            //[Account In Gitee] @accountInGitee
            //[Version] @version

            //[Description] @description
            //";
            //            helpInfo = helpInfo.Replace("@author", "夜黔");
            //            helpInfo = helpInfo.Replace("@accountInGitee", "@kamome");
            //            helpInfo = helpInfo.Replace("@version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            //            helpInfo = helpInfo.Replace("@description", "一个没什么卵用的命令框架。输入`hyd lc` 查看所有的命令吧少年。");
            //SConsole.WriteLine(helpInfo);

            //Console.ConsoleLog.WriteTreeLevel("<{0}>", Console.ConsoleLog.NormalColor, 0, false, "Hydrogen.Cmd");
            //Console.ConsoleLog.WriteTreeLevel("[Author] {0}", Console.ConsoleLog.NormalColor, 1, false, "夜黔");
            //Console.ConsoleLog.WriteTreeLevel("[Account In Gitee] {0}", Console.ConsoleLog.NormalColor, 2, false, "@kamome");
            //Console.ConsoleLog.WriteTreeLevel("[Version] {0}", Console.ConsoleLog.NormalColor, 1, false, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            //Console.ConsoleLog.WriteTreeLevel("[Description] {0}", System.ConsoleColor.Green, 1, false, "一个没什么卵用的命令框架。输入`hyd lc` 查看所有的命令吧少年。");

            List<ConsoleTreeNode> nodeList = new List<ConsoleTreeNode>();
            nodeList.Add(new ConsoleTreeNode() { level = 0, onDraw = () => ConsoleLog.WriteColorLine("<{0}>", Console.ConsoleLog.NormalColor, "Hydrogen.Cmd") });
            nodeList.Add(new ConsoleTreeNode() { level = 1, onDraw = () => ConsoleLog.WriteColorLine("[Author] {0}", Console.ConsoleLog.NormalColor, "夜黔") });
            nodeList.Add(new ConsoleTreeNode() { level = 2, onDraw = () => ConsoleLog.WriteColorLine("[Account In Gitee] {0}", Console.ConsoleLog.NormalColor, "@kamome") });
            nodeList.Add(new ConsoleTreeNode() { level = 1, onDraw = () => ConsoleLog.WriteColorLine("[Version] {0}", Console.ConsoleLog.NormalColor, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()) });
            nodeList.Add(new ConsoleTreeNode() { level = 1, onDraw = () => ConsoleLog.WriteColorLine("[Description] {0}", System.ConsoleColor.Green, "一个没什么卵用的命令框架。输入`hyd lc` 查看所有的命令吧少年。") });
            ConsoleLog.Write(nodeList);
        }
    }
}
